import org.annotation.LtdAd;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * Created by chinalin on 2017/3/21.
 */
//AnnotationTest2类的注解及属性
/*@MyAnnotation(annotationAttr=@MetaAnnotation("flx"),color="red",value="abc",arrayAttr={1,2,3})*/
@MyAnnotation(china = LtdAd.class,value = "abc",color = "red",arrayAttr = {2,3,4},isTrue = false,lamp = EnumTest.TrafficLamp.WED,annotationAttr = @MetaAnnotation(value = "chinalintd",metaLamp = EnumTest.TrafficLamp.SAT))
public class AnnotationTest2 {

    /*@MyAnnotation("xyz")  //main方法的注解的属性value="xyz"*/
    public static void main(String[] args) {
        if (AnnotationTest2.class.isAnnotationPresent(MyAnnotation.class)){

            MyAnnotation myAnnotation = (MyAnnotation)AnnotationTest2.class.getAnnotation(MyAnnotation.class);
//            System.out.println(myAnnotation.color());
//            System.out.println(myAnnotation);
//            System.out.println(myAnnotation.lamp().toString());
//            for (EnumTest.TrafficLamp e : EnumTest.TrafficLamp.values()){
//                System.out.println(e.toString());
//            }
//            MetaAnnotation me = myAnnotation.annotationAttr() ;
//            System.out.println(me);
//            System.out.println(me.value());

            System. out.println(myAnnotation.color());
            //结果：red
            System. out.println(myAnnotation.arrayAttr().length);
            //结果：3
            System. out.println("===========================");
            System. out.println(myAnnotation.lamp().ordinal());
            System. out.println(myAnnotation.lamp().nextLamp().name());
            System. out.println("===========================");
//            System. out.println(myAnnotation.lamp().name());
            //结果：GREEN
            System. out.println(myAnnotation.annotationAttr().value());
            //结果：flx
            System. out.println(myAnnotation.clazz());
            //结果：class java.lang.String

            EnumTest.TrafficLamp lamp;

        }
    }
}
